home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / utils / conftest / conftest.c next >
Encoding:
C/C++ Source or Header  |  1992-12-26  |  834 b   |  41 lines

  1. #include <exec/exec.h>
  2. #include <exec/memory.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. #include <clib/exec_protos.h>
  8. struct ConfBase
  9. {
  10.   char Name[30];
  11.   int Value;
  12. };
  13.  
  14. struct ConfBase *Temp[1000];
  15. main()
  16. {
  17.   int i;
  18.   struct ConfBase conf;
  19.   for(i=0;i<999;i++)
  20.   {
  21.      Temp[i]=(struct ConfBase *)AllocMem(sizeof(struct ConfBase),MEMF_CLEAR);
  22.      Temp[i]->Value=i;
  23.   }
  24.   printf("Value of Struct 1= %d\n",Temp[0]->Value);
  25.   printf("Value of Struct 5= %d\n",Temp[4]->Value);
  26.   conf.Value=10;
  27.  
  28.   CopyMem((APTR)&conf,(APTR)Temp[0],sizeof(struct ConfBase));
  29.  
  30.   printf("Value of Struct 1= %d\n",Temp[0]->Value);
  31.  
  32.   CopyMem((APTR)Temp[4],(APTR)&conf,sizeof(struct ConfBase));
  33.  
  34.   printf("Value of conf    = %d\n",conf.Value);
  35.  
  36.   for(i=0;i<999;i++)
  37.   {
  38.     FreeMem((APTR)Temp[i],sizeof(struct ConfBase));
  39.   }
  40.   exit(0);
  41. }